import {
  observable,
  reaction,
  batch,
} from "../../designer-antd-v5/packages/formily-reactive/src";

const FormilyReactive: React.FC = () => {
  const obs = observable({
    aa: 1,
    bb: 2,
  });

  const dispose = reaction(() => {
    return obs.aa + obs.bb;
  }, console.log);

  batch(() => {
    //不会触发，因为obs.aa + obs.bb值没变
    obs.aa = 2;
    obs.bb = 1;
  });

  obs.aa = 4;

  dispose();
  return <div>FormilyReactive</div>;
};

export default FormilyReactive;
